\(\int (1+x)^m (1+2 x+x^2)^n \, dx\) [1449]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [C] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 16, antiderivative size = 26 \[ \int (1+x)^m \left (1+2 x+x^2\right )^n \, dx=\frac {(1+x)^{1+m} \left (1+2 x+x^2\right )^n}{1+m+2 n} \]

[Out]

(1+x)^(1+m)*(x^2+2*x+1)^n/(1+m+2*n)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {658, 32} \[ \int (1+x)^m \left (1+2 x+x^2\right )^n \, dx=\frac {(x+1)^{m+1} \left (x^2+2 x+1\right )^n}{m+2 n+1} \]

[In]

Int[(1 + x)^m*(1 + 2*x + x^2)^n,x]

[Out]

((1 + x)^(1 + m)*(1 + 2*x + x^2)^n)/(1 + m + 2*n)

Rule 32

Int[((a_.) + (b_.)*(x_))^(m_), x_Symbol] :> Simp[(a + b*x)^(m + 1)/(b*(m + 1)), x] /; FreeQ[{a, b, m}, x] && N
eQ[m, -1]

Rule 658

Int[((d_) + (e_.)*(x_))^(m_)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Dist[(a + b*x + c*x^2)^p/(d
 + e*x)^(2*p), Int[(d + e*x)^(m + 2*p), x], x] /; FreeQ[{a, b, c, d, e, m, p}, x] && EqQ[b^2 - 4*a*c, 0] &&  !
IntegerQ[p] && EqQ[2*c*d - b*e, 0] &&  !IntegerQ[m]

Rubi steps \begin{align*} \text {integral}& = \left ((1+x)^{-2 n} \left (1+2 x+x^2\right )^n\right ) \int (1+x)^{m+2 n} \, dx \\ & = \frac {(1+x)^{1+m} \left (1+2 x+x^2\right )^n}{1+m+2 n} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 23, normalized size of antiderivative = 0.88 \[ \int (1+x)^m \left (1+2 x+x^2\right )^n \, dx=\frac {(1+x)^{1+m} \left ((1+x)^2\right )^n}{1+m+2 n} \]

[In]

Integrate[(1 + x)^m*(1 + 2*x + x^2)^n,x]

[Out]

((1 + x)^(1 + m)*((1 + x)^2)^n)/(1 + m + 2*n)

Maple [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3.

Time = 2.30 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.69

method result size
meijerg \(x {}_{2}^{}{\moversetsp {}{\mundersetsp {}{F_{1}^{}}}}\left (1,-m -2 n ;2;-x \right )\) \(18\)
gosper \(\frac {\left (1+x \right )^{1+m} \left (x^{2}+2 x +1\right )^{n}}{1+m +2 n}\) \(27\)
parallelrisch \(\frac {\left (x^{2}+2 x +1\right )^{n} x \left (1+x \right )^{m}+\left (1+x \right )^{m} \left (x^{2}+2 x +1\right )^{n}}{1+m +2 n}\) \(44\)
norman \(\frac {{\mathrm e}^{\ln \left (1+x \right ) m} {\mathrm e}^{n \ln \left (x^{2}+2 x +1\right )}}{1+m +2 n}+\frac {x \,{\mathrm e}^{\ln \left (1+x \right ) m} {\mathrm e}^{n \ln \left (x^{2}+2 x +1\right )}}{1+m +2 n}\) \(59\)
risch \(\frac {\left (1+x \right )^{m} \left (1+x \right ) \left (1+x \right )^{2 n} {\mathrm e}^{-\frac {i \operatorname {csgn}\left (i \left (1+x \right )^{2}\right ) \pi n {\left (-\operatorname {csgn}\left (i \left (1+x \right )^{2}\right )+\operatorname {csgn}\left (i \left (1+x \right )\right )\right )}^{2}}{2}}}{1+m +2 n}\) \(61\)

[In]

int((1+x)^m*(x^2+2*x+1)^n,x,method=_RETURNVERBOSE)

[Out]

x*hypergeom([1,-m-2*n],[2],-x)

Fricas [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.92 \[ \int (1+x)^m \left (1+2 x+x^2\right )^n \, dx=\frac {{\left (x + 1\right )}^{m} {\left (x + 1\right )}^{2 \, n} {\left (x + 1\right )}}{m + 2 \, n + 1} \]

[In]

integrate((1+x)^m*(x^2+2*x+1)^n,x, algorithm="fricas")

[Out]

(x + 1)^m*(x + 1)^(2*n)*(x + 1)/(m + 2*n + 1)

Sympy [F]

\[ \int (1+x)^m \left (1+2 x+x^2\right )^n \, dx=\begin {cases} \frac {x \left (x + 1\right )^{m} \left (x^{2} + 2 x + 1\right )^{n}}{m + 2 n + 1} + \frac {\left (x + 1\right )^{m} \left (x^{2} + 2 x + 1\right )^{n}}{m + 2 n + 1} & \text {for}\: m \neq - 2 n - 1 \\\int \left (x + 1\right )^{- 2 n - 1} \left (\left (x + 1\right )^{2}\right )^{n}\, dx & \text {otherwise} \end {cases} \]

[In]

integrate((1+x)**m*(x**2+2*x+1)**n,x)

[Out]

Piecewise((x*(x + 1)**m*(x**2 + 2*x + 1)**n/(m + 2*n + 1) + (x + 1)**m*(x**2 + 2*x + 1)**n/(m + 2*n + 1), Ne(m
, -2*n - 1)), (Integral((x + 1)**(-2*n - 1)*((x + 1)**2)**n, x), True))

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.04 \[ \int (1+x)^m \left (1+2 x+x^2\right )^n \, dx=\frac {{\left (x + 1\right )} e^{\left (m \log \left (x + 1\right ) + 2 \, n \log \left (x + 1\right )\right )}}{m + 2 \, n + 1} \]

[In]

integrate((1+x)^m*(x^2+2*x+1)^n,x, algorithm="maxima")

[Out]

(x + 1)*e^(m*log(x + 1) + 2*n*log(x + 1))/(m + 2*n + 1)

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.42 \[ \int (1+x)^m \left (1+2 x+x^2\right )^n \, dx=\frac {{\left (x + 1\right )}^{m} {\left (x + 1\right )}^{2 \, n} x + {\left (x + 1\right )}^{m} {\left (x + 1\right )}^{2 \, n}}{m + 2 \, n + 1} \]

[In]

integrate((1+x)^m*(x^2+2*x+1)^n,x, algorithm="giac")

[Out]

((x + 1)^m*(x + 1)^(2*n)*x + (x + 1)^m*(x + 1)^(2*n))/(m + 2*n + 1)

Mupad [B] (verification not implemented)

Time = 9.89 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.00 \[ \int (1+x)^m \left (1+2 x+x^2\right )^n \, dx=\frac {{\left (x+1\right )}^{m+1}\,{\left (x^2+2\,x+1\right )}^n}{m+2\,n+1} \]

[In]

int((x + 1)^m*(2*x + x^2 + 1)^n,x)

[Out]

((x + 1)^(m + 1)*(2*x + x^2 + 1)^n)/(m + 2*n + 1)